<access_control grant="admin, dev">
    <choose>
        <when test="$GET_Mode == 'disconnect'">
            <?
            Erra_System_AccessControl::setRole('default');
            Erra_System_PageBuilder::redirect(config_get("application.http_webroot"));
            ?>
        </when>
        <!-- NAVIGATION -->
        <when test="$GET_Mode == 'navigation'">
            <include src="Admin_Navigation.phtml" />
        </when>
        <!-- TRANSLATIONS -->
        <when test="$GET_Mode == 'localize' && Erra_Core_Locale::applicationIsMultiLang()">
            <include src="Admin_Translate.phtml" />
        </when>
        <!-- VIEWS -->
        <when test="$GET_Mode == 'views' && Erra_System_AccessControl::is('dev')">
            <include src="Admin_Views.phtml" />
        </when>
        <!-- OBJECTS -->
        <when test="$GET_Mode == 'objects' && Erra_System_AccessControl::is('dev')">
            <div>
                <?= Erra_System_Factory::getFieldObject('Base_FileEditorObject', 'editObjectFiles', 'CREATE', null, 'objects')->_form('AdminAction/saveEditorFile') ?>
            </div>
        </when>
        <!-- LAYOUTS -->
        <when test="$GET_Mode == 'layouts' && Erra_System_AccessControl::is('dev')">
            <div>
                <?= Erra_System_Factory::getFieldObject('Base_FileEditorObject', 'editLayoutFiles', 'CREATE', null, 'layouts')->_form('AdminAction/saveEditorFile') ?>
            </div>
        </when>
        <!-- SQL -->
        <when test="$GET_Mode == 'sql' && Erra_System_AccessControl::is('dev')">
            <include src="Admin_Sql.phtml" />
        </when>
        <!-- BACKUPS -->
        <when test="$GET_Mode == 'backups' && Erra_System_AccessControl::is('dev')">
            <include src="Admin_Backups.phtml" />
        </when>
        <!-- DISPLAY TEMPLATES AND EDIT PAGES -->
        <otherwise>
        <?php
        if (Erra_Core_DatabasePdo::_SELECT('SELECT id FROM ufm__pages WHERE page_url="default"')) {
            if (!Erra_Core_DatabasePdo::rowCount()) {
                echo '<center>'.Erra_Utils_Tools::message('warning', __("Page with URL route `default` is missing. Your application doesn't have any entry point yet !")).'</center><br/>';
            }
        }
        if (Erra_System_AccessControl::is('dev')) {
            echo Erra_System_Factory::getFieldList('Base_LayoutObject')->setCrud('CRUD')->_form('AdminAction/saveSql');
        } else {
            echo Erra_System_Factory::getFieldList('Base_LayoutObject')->setCrud('RU')->_form('AdminAction/saveSql');
        }
        ?>
        </otherwise>
    </choose>
</access_control>